package com.example.himalayaproject.find.broadcast.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.example.himalayaproject.find.broadcast.bean.ProvinceResult;
import com.example.himalayaproject.find.broadcast.fragment.ProvinceRecyclerFragment;

import java.util.List;

/**
 * Created by Administrator on 2016/12/8.
 */

public class ProvinceTabAdapter extends FragmentPagerAdapter {
    private List<ProvinceResult> datas;
    public ProvinceTabAdapter(FragmentManager fm,List<ProvinceResult> datas) {
        super(fm);
        this.datas = datas;
    }

    @Override
    public Fragment getItem(int position) {
        return ProvinceRecyclerFragment.newInstance(datas.get(position).getProvinceCode());
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return datas.get(position).getProvinceName();
    }
}
